package com.subaiqiao.yunshiyuan.config.config;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web配置
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer {

    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor).addPathPatterns("/**")
        .excludePathPatterns("/swagger-ui.html/**")
        .excludePathPatterns("/webjars/**")
        .excludePathPatterns("/swagger-resources/**")
        .excludePathPatterns("/favicon.ico");
    }
}
